<template>
  <div id="top-header">
    <div class="center-title">{{ $t('dianShangYunYingDaShuJuKeShiHuaPingTai') }}</div>
    <div class="time-center">
      <div class="hh">{{ $moment(date).format('HH:mm:ss') }}</div>
      <div class="day"><i></i>{{ $moment(new Date()).format('YYYY-MM-DD') }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TopHeader',
  data() {
    return {
      date: new Date(),
    };
  },
  mounted() {
    this.time();
  },
  methods: {
    time() {
      this.timeOut = setInterval(() => {
        this.date = new Date();
      }, 1000);
    },
  },
  beforeDestroy() {
    clearInterval(this.timeOut);
  },
};
</script>

<style lang="scss">
#top-header {
  position: relative;
  width: 100%;
  height: 190px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  background-image: url('~@/assets/datav/head.png');
  background-size: 100% 100%;

  .center-title {
    position: absolute;
    font-size: 30px;
    font-weight: bold;
    left: 50%;
    top: 15px;
    transform: translateX(-50%);
  }
  .time-center {
    margin-top: 50px;
    margin-right: 32px;
    display: flex;
    font-size: 24px;
    font-family: 'Roboto Condensed';
    line-height: 28px;
    .hh {
      padding-left: 44px;
      position: relative;
      margin-right: 32px;
      &::after {
        content: '';
        width: 12px;
        height: 2px;
        background: #ffda98;
        box-shadow: 0px 0px 4px 1px #ff6a3a;
        position: absolute;
        left: 0;
        top: 13px;
      }
    }
    .day {
      padding-left: 44px;
      position: relative;
      margin-right: 32px;
      i {
        &::after {
          content: '';
          /* Rectangle */
          width: 3px;
          height: 10px;
          background: #ffd03b;
          box-shadow: 0px 0px 8px 0px #ffa13f;

          position: absolute;
          left: 0;
          top: 2px;
        }
        &::before {
          content: '';
          /* Rectangle */
          width: 3px;
          height: 10px;
          background: #ffd03b;
          box-shadow: 0px 0px 8px 0px #ffa13f;

          position: absolute;
          left: 0;
          top: 16px;
        }
      }
    }
  }
}
</style>
